﻿using System;

namespace diantou.dataModel
{
    /// <summary>
    /// 用户日志
    /// </summary>
    [fastCSharp.emit.jsonSerialize(IsAllMember = true)]
    [fastCSharp.emit.dataSerialize(IsReferenceMember = false, IsMemberMap = false)]
    [fastCSharp.code.cSharp.webView.clientType(Name = "diantou.log")]
    [fastCSharp.code.cSharp.sqlModel]
    public partial class log
    {
        /// <summary>
        /// 日志标识
        /// </summary>
        [fastCSharp.code.cSharp.webView.outputAjax]
        public int Id;
        /// <summary>
        /// 日志用户标识
        /// </summary>
        public int CreatorId;
        /// <summary>
        /// 日志时间
        /// </summary>
        public DateTime LogTime = fastCSharp.date.NowSecond;
        /// <summary>
        /// 日志类型
        /// </summary>
        public sealed class logInfo : Attribute
        {
            /// <summary>
            /// 有效值类型集合
            /// </summary>
            public isValue IsValue = isValue.None;
            /// <summary>
            /// 非有效值类型集合
            /// </summary>
            public isValue ValuesLess;
            /// <summary>
            /// 所有值类型集合
            /// </summary>
            public isValue Values
            {
                get { return IsValue | ValuesLess; }
            }
        }
        /// <summary>
        /// 日志类型
        /// </summary>
        public enum type : byte
        {
            /// <summary>
            /// 修改用户头像
            /// </summary>
            [logInfo(ValuesLess = isValue.Creator)]
            ReworkAvatar = 0,
            /// <summary>
            /// 关注用户
            /// </summary>
            [logInfo(ValuesLess = isValue.Creator | isValue.User)]
            FocusUser = 1,
            /// <summary>
            /// 创建话题
            /// </summary>
            [logInfo(ValuesLess = isValue.Creator | isValue.Topic)]
            CreateTopic = 2,
            /// <summary>
            /// 关注话题
            /// </summary>
            [logInfo(ValuesLess = isValue.Creator | isValue.Topic)]
            FocusTopic = 3,
            /// <summary>
            /// 修改话题名称
            /// </summary>
            [logInfo(ValuesLess = isValue.Creator | isValue.Topic)]
            ReworkTopicName = 4,
            /// <summary>
            /// 修改话题描述
            /// </summary>
            [logInfo(ValuesLess = isValue.Creator | isValue.Topic)]
            ReworkTopicDescription = 5,
            /// <summary>
            /// 修改话题图片
            /// </summary>
            [logInfo(ValuesLess = isValue.Creator | isValue.Topic)]
            ReworkTopicLogo = 6,
            /// <summary>
            /// 修改话题经验
            /// </summary>
            [logInfo(ValuesLess = isValue.Creator | isValue.Topic)]
            ReworkTopicExperience = 7,
            /// <summary>
            /// 创建问题
            /// </summary>
            [logInfo(ValuesLess = isValue.Creator | isValue.Question)]
            CreateQuestion = 8,
            /// <summary>
            /// 关注问题
            /// </summary>
            [logInfo(ValuesLess = isValue.Creator | isValue.Question)]
            FocusQuestion = 9,
            /// <summary>
            /// 同问问题(已过期)
            /// </summary>
            [logInfo(ValuesLess = isValue.Creator | isValue.Question)]
            _SameQuestion = 10,
            /// <summary>
            /// 修改问题标题
            /// </summary>
            [logInfo(ValuesLess = isValue.Creator | isValue.Question)]
            ReworkQuestionTitle = 11,
            /// <summary>
            /// 修改问题描述
            /// </summary>
            [logInfo(ValuesLess = isValue.Creator | isValue.Question)]
            ReworkQuestionDescription = 12,
            /// <summary>
            /// 添加问题评论
            /// </summary>
            [logInfo(IsValue = isValue.QuestionComment, ValuesLess = isValue.Creator | isValue.Question)]
            AppendQuestionComment = 13,
            /// <summary>
            /// 添加问题话题
            /// </summary>
            [logInfo(ValuesLess = isValue.Creator | isValue.Question | isValue.Topic)]
            AppendQuestionTopic = 14,
            /// <summary>
            /// 删除问题话题
            /// </summary>
            [logInfo(ValuesLess = isValue.Creator | isValue.Question | isValue.Topic)]
            RemoveQuestionTopic = 15,
            /// <summary>
            /// 修改问题重定向
            /// </summary>
            [logInfo(ValuesLess = isValue.Creator | isValue.Question | isValue.LinkQuestion)]
            SetQuestionLink = 16,
            /// <summary>
            /// 取消问题重定向
            /// </summary>
            [logInfo(ValuesLess = isValue.Creator | isValue.Question | isValue.LinkQuestion)]
            CancelQuestionLink = 17,
            /// <summary>
            /// 管理员锁定问题
            /// </summary>
            [logInfo(ValuesLess = isValue.Question)]
            LockQuestion = 18,
            /// <summary>
            /// 管理员解锁问题
            /// </summary>
            [logInfo(ValuesLess = isValue.Question)]
            UnlockQuestion = 19,
            /// <summary>
            /// 回答问题
            /// </summary>
            [logInfo(IsValue = isValue.Answer, ValuesLess = isValue.Creator | isValue.Question)]
            CreateAnswer = 20,
            /// <summary>
            /// 修改回答
            /// </summary>
            [logInfo(IsValue = isValue.Answer, ValuesLess = isValue.Creator | isValue.Question)]
            ReworkAnswer = 21,
            /// <summary>
            /// 赞成回答
            /// </summary>
            [logInfo(IsValue = isValue.Answer, ValuesLess = isValue.Creator | isValue.Question)]
            AgreeAnswer = 22,
            /// <summary>
            /// 反对回答
            /// </summary>
            [logInfo(IsValue = isValue.Answer, ValuesLess = isValue.Creator | isValue.Question)]
            OpposeAnswer = 23,
            /// <summary>
            /// 回答没有帮助
            /// </summary>
            [logInfo(IsValue = isValue.Answer, ValuesLess = isValue.Creator | isValue.Question)]
            NoHelpAnswer = 24,
            /// <summary>
            /// 添加回答评论
            /// </summary>
            [logInfo(IsValue = isValue.Answer | isValue.AnswerComment, ValuesLess = isValue.Creator | isValue.Question)]
            AppendAnswerComment = 25,
            /// <summary>
            /// 删除回答
            /// </summary>
            [logInfo(IsValue = isValue.Answer, ValuesLess = isValue.Creator | isValue.Question)]
            DeleteAnswer = 26,
            /// <summary>
            /// 恢复回答
            /// </summary>
            [logInfo(IsValue = isValue.Answer, ValuesLess = isValue.Creator | isValue.Question)]
            RestoreAnswer = 27,
            /// <summary>
            /// 取消关注用户
            /// </summary>
            [logInfo(ValuesLess = isValue.Creator | isValue.User)]
            CancelFocusUser = 28,
            /// <summary>
            /// 取消关注话题
            /// </summary>
            [logInfo(ValuesLess = isValue.Creator | isValue.Topic)]
            CancelFocusTopic = 29,
            /// <summary>
            /// 取消关注问题
            /// </summary>
            [logInfo(ValuesLess = isValue.Creator | isValue.Question)]
            CancelFocusQuestion = 30,
            /// <summary>
            /// 关注收藏夹
            /// </summary>
            [logInfo(IsValue = isValue.Favorite, ValuesLess = isValue.Creator)]
            FocusFavorite = 31,
            /// <summary>
            /// 取消关注收藏夹
            /// </summary>
            [logInfo(IsValue = isValue.Favorite, ValuesLess = isValue.Creator)]
            CancelFocusFavorite = 32,
            /// <summary>
            /// 取消赞成回答
            /// </summary>
            [logInfo(IsValue = isValue.Answer, ValuesLess = isValue.Creator | isValue.Question)]
            CancelAgreeAnswer = 33,
            /// <summary>
            /// 取消反对回答
            /// </summary>
            [logInfo(IsValue = isValue.Answer, ValuesLess = isValue.Creator | isValue.Question)]
            CancelOpposeAnswer = 34,
            /// <summary>
            /// 感谢回答
            /// </summary>
            [logInfo(IsValue = isValue.Answer, ValuesLess = isValue.Creator | isValue.Question)]
            ThankAnswer = 35,
            /// <summary>
            /// 邀请回答
            /// </summary>
            [logInfo(ValuesLess = isValue.Creator | isValue.User | isValue.Question)]
            InviteAnswer = 36,
            /// <summary>
            /// 创建问题草稿
            /// </summary>
            //createDraft,
            /// <summary>
            /// 修改问题草稿
            /// </summary>
            //reworkDraft,
            /// <summary>
            /// 删除问题草稿
            /// </summary>
            //deleteDraft,
            /// <summary>
            /// 管理员锁定话题
            /// </summary>
            [logInfo(ValuesLess = isValue.Topic)]
            LockTopic = 37,
            /// <summary>
            /// 管理员解锁话题
            /// </summary>
            [logInfo(ValuesLess = isValue.Topic)]
            UnlockTopic = 38,
            /// <summary>
            /// 话题添加相关话题
            /// </summary>
            [logInfo(ValuesLess = isValue.Creator | isValue.Topic | isValue.LinkTopic)]
            TopicAppendTopic = 39,
            /// <summary>
            /// 话题删除相关话题
            /// </summary>
            [logInfo(ValuesLess = isValue.Creator | isValue.Topic | isValue.LinkTopic)]
            TopicRemoveTopic = 40,
            /// <summary>
            /// 创建话题经验
            /// </summary>
            [logInfo(ValuesLess = isValue.Creator | isValue.Topic)]
            CreateTopicExperience = 41,
            /// <summary>
            /// 删除话题经验
            /// </summary>
            [logInfo(ValuesLess = isValue.Creator | isValue.Topic)]
            DeleteTopicExperience = 42,
            /// <summary>
            /// 修改用户简介
            /// </summary>
            [logInfo(ValuesLess = isValue.Creator)]
            ReworkIntroduction = 43,
            /// <summary>
            /// 修改用户描述
            /// </summary>
            [logInfo(ValuesLess = isValue.Creator)]
            ReworkDescription = 44,
            /// <summary>
            /// 创建收藏夹
            /// </summary>
            [logInfo(IsValue = isValue.Favorite, ValuesLess = isValue.Creator)]
            CreateFavorite = 45,
            /// <summary>
            /// 收藏夹添加了答案
            /// </summary>
            [logInfo(IsValue = isValue.Favorite | isValue.Answer, ValuesLess = isValue.Creator | isValue.Question)]
            FavoriteAppendAnswer = 46,
            /// <summary>
            /// 收藏夹删除了答案
            /// </summary>
            [logInfo(IsValue = isValue.Favorite | isValue.Answer, ValuesLess = isValue.Creator | isValue.Question)]
            FavoriteRemoveAnswer = 47,
            /// <summary>
            /// 修改收藏夹名称
            /// </summary>
            [logInfo(IsValue = isValue.Favorite, ValuesLess = isValue.Creator)]
            ReworkFavoriteName = 48,
            /// <summary>
            /// 修改收藏夹描述
            /// </summary>
            [logInfo(IsValue = isValue.Favorite, ValuesLess = isValue.Creator)]
            ReworkFavoriteDescription = 49,
            /// <summary>
            /// 收藏夹添加了问题
            /// </summary>
            [logInfo(IsValue = isValue.Favorite, ValuesLess = isValue.Creator | isValue.Question)]
            FavoriteAppendQuestion = 50,
            /// <summary>
            /// 收藏夹删除了问题
            /// </summary>
            [logInfo(IsValue = isValue.Favorite, ValuesLess = isValue.Creator | isValue.Question)]
            FavoriteRemoveQuestion = 51,
            /// <summary>
            /// 收藏夹添加了话题
            /// </summary>
            [logInfo(IsValue = isValue.Favorite, ValuesLess = isValue.Creator | isValue.Topic)]
            FavoriteAppendTopic = 52,
            /// <summary>
            /// 收藏夹删除了话题
            /// </summary>
            [logInfo(IsValue = isValue.Favorite, ValuesLess = isValue.Creator | isValue.Topic)]
            FavoriteRemoveTopic = 53,
            /// <summary>
            /// 收藏夹添加了用户
            /// </summary>
            [logInfo(IsValue = isValue.Favorite, ValuesLess = isValue.Creator | isValue.User)]
            FavoriteAppendUser = 54,
            /// <summary>
            /// 收藏夹删除了用户
            /// </summary>
            [logInfo(IsValue = isValue.Favorite, ValuesLess = isValue.Creator | isValue.User)]
            FavoriteRemoveUser = 55,
            /// <summary>
            /// 收藏夹添加了收藏夹
            /// </summary>
            [logInfo(IsValue = isValue.Favorite | isValue.LinkFavorite, ValuesLess = isValue.Creator)]
            FavoriteAppendFavorite = 56,
            /// <summary>
            /// 收藏夹删除了收藏夹
            /// </summary>
            [logInfo(IsValue = isValue.Favorite | isValue.LinkFavorite, ValuesLess = isValue.Creator)]
            FavoriteRemoveFavorite = 57,
            /// <summary>
            /// 在线测试AC
            /// </summary>
            [logInfo(IsValue = isValue.Problem, ValuesLess = isValue.Creator)]
            OnlineJudgeAccepted = 58,
            /// <summary>
            /// 收藏夹删除了问题
            /// </summary>
            [logInfo(IsValue = isValue.Favorite, ValuesLess = isValue.Creator | isValue.Problem)]
            FavoriteRemoveProblem = 59,
            /// <summary>
            /// 收藏夹添加了问题
            /// </summary>
            [logInfo(IsValue = isValue.Favorite, ValuesLess = isValue.Creator | isValue.Problem)]
            FavoriteAppendProblem = 60,
            /// <summary>
            /// 添加测试提交评论
            /// </summary>
            [logInfo(IsValue = isValue.JudgeComment, ValuesLess = isValue.Creator | isValue.Judge | isValue.Problem)]
            JudgeQuestionComment = 61,
            /// <summary>
            /// 收藏夹删除了比赛
            /// </summary>
            [logInfo(IsValue = isValue.Favorite, ValuesLess = isValue.Creator | isValue.Problem)]
            FavoriteRemoveContest = 62,
            /// <summary>
            /// 收藏夹添加了比赛
            /// </summary>
            [logInfo(IsValue = isValue.Favorite, ValuesLess = isValue.Creator | isValue.Problem)]
            FavoriteAppendContest = 63,
            /// <summary>
            /// 用户注册了比赛
            /// </summary>
            [logInfo(IsValue = isValue.Contest, ValuesLess = isValue.Creator)]
            RegisterContest = 64,
        }
        /// <summary>
        /// 日志类型
        /// </summary>
        [fastCSharp.emit.dataMember(DataType = typeof(byte))]
        public type Type;
        /// <summary>
        /// 关联用户标识
        /// </summary>
        public int UserId;
        /// <summary>
        /// 关联话题标识
        /// </summary>
        public int TopicId;
        /// <summary>
        /// 话题相关话题标识
        /// </summary>
        public int LinkTopicId;
        /// <summary>
        /// 关联问题标识
        /// </summary>
        public int QuestionId;
        /// <summary>
        /// 重定向问题标识
        /// </summary>
        public int LinkQuestionId;
        /// <summary>
        /// 关联回答标识
        /// </summary>
        public int AnswerId;
        /// <summary>
        /// 关联收藏夹标识
        /// </summary>
        public int FavoriteId;
        /// <summary>
        /// 被收藏关联收藏夹标识
        /// </summary>
        public int LinkFavoriteId;
        /// <summary>
        /// 关联评论标识
        /// </summary>
        public int CommentId;
        /// <summary>
        /// OJ问题标识
        /// </summary>
        public int ProblemId;
        /// <summary>
        /// 提交测试标识
        /// </summary>
        public int JudgeId;
        /// <summary>
        /// 比赛标识
        /// </summary>
        public int ContestId;

        /// <summary>
        /// 日志说明
        /// </summary>
        [fastCSharp.emit.dataSerialize.member(IsIgnoreCurrent = true)]
        [fastCSharp.emit.dataMember(Group = 1, MaxStringLength = 128)]
        public string Remark = string.Empty;
        /// <summary>
        /// 目标是否被删除
        /// </summary>
        [fastCSharp.emit.dataSerialize.member(IsIgnoreCurrent = true)]
        [fastCSharp.emit.dataMember(Group = 1)]
        public bool IsDelete;
        /// <summary>
        /// 原始内容
        /// </summary>
        [fastCSharp.emit.dataSerialize.member(IsIgnoreCurrent = true)]
        [fastCSharp.emit.dataMember(Group = 1, IsIgnoreMaxStringLength = true)]
        public string HistoryContent = string.Empty;
        /// <summary>
        /// 新内容
        /// </summary>
        [fastCSharp.emit.dataSerialize.member(IsIgnoreCurrent = true)]
        [fastCSharp.emit.dataMember(Group = 1, IsIgnoreMaxStringLength = true)]
        public string NewContent = string.Empty;
    }
}
